package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.vo.StoreroomAndUserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.StoreroomMapper;
import com.ruoyi.system.domain.Storeroom;
import com.ruoyi.system.service.IStoreroomService;
import com.ruoyi.common.core.text.Convert;

/**
 * 库房列表Service业务层处理
 * 
 * @author mqs
 * @date 2024-05-01
 */
@Service
public class StoreroomServiceImpl implements IStoreroomService 
{
    @Autowired
    private StoreroomMapper storeroomMapper;

    /**
     * 查询库房列表
     *
     * @param storeroomId 库房列表主键
     * @return 库房列表
     */
    @Override
    public StoreroomAndUserVO selectStoreroomByStoreroomId(Long storeroomId)
    {
        return storeroomMapper.selectStoreroomByStoreroomId(storeroomId);
    }

    @Override
    public List<StoreroomAndUserVO> selectStoreroom() {
        return storeroomMapper.selectStoreroom();
    }

    /**
     * 查询库房列表列表
     *
     * @param storeroom 库房列表
     * @return 库房列表
     */
    @Override
    public List<StoreroomAndUserVO> selectStoreroomList(Storeroom storeroom)
    {
        return storeroomMapper.selectStoreroomList(storeroom);
    }

    /**
     * 新增库房列表
     *
     * @param storeroom 库房列表
     * @return 结果
     */
    @Override
    public int insertStoreroom(Storeroom storeroom)
    {
        storeroom.setCreateTime(DateUtils.getNowDate());
        return storeroomMapper.insertStoreroom(storeroom);
    }

    /**
     * 修改库房列表
     *
     * @param storeroom 库房列表
     * @return 结果
     */
    @Override
    public int updateStoreroom(Storeroom storeroom)
    {
        storeroom.setUpdateTime(DateUtils.getNowDate());
        return storeroomMapper.updateStoreroom(storeroom);
    }

    /**
     * 批量删除库房列表
     *
     * @param storeroomIds 需要删除的库房列表主键
     * @return 结果
     */
    @Override
    public int deleteStoreroomByStoreroomIds(String storeroomIds)
    {
        return storeroomMapper.deleteStoreroomByStoreroomIds(Convert.toStrArray(storeroomIds));
    }

    /**
     * 批量删除库房列表
     *
     * @param storerooms 需要删除的库房列表主键
     * @return 结果
     */
    @Override
    public Integer deleteStorerooms(List<Storeroom> storerooms) {
        return storeroomMapper.deleteStorerooms(storerooms);
    }

    /**
     * 删除库房列表信息
     *
     * @param storeroomId 库房列表主键
     * @return 结果
     */
    @Override
    public int deleteStoreroomByStoreroomId(Long storeroomId)
    {
        return storeroomMapper.deleteStoreroomByStoreroomId(storeroomId);
    }

    @Override
    public StoreroomAndUserVO selectStoreroomByName(String storeroomName) {
        return storeroomMapper.selectStoreroomByName(storeroomName);
    }
}
